package com.achievo.reportserver.config;

import org.apache.commons.configuration.event.ConfigurationEvent;
import org.apache.commons.configuration.event.ConfigurationListener;
import org.apache.log4j.Logger;

import com.achievo.reportserver.ds.DataSourceFactory;


/**
 * 
 * Report Server
 * write at Jan 21, 2010
 * @author <a href="mailto:chinaoryx@gmail.com">Hyman.Zhang (Zhang Haipeng)</a>
 * @version 1.0
 * 
 *
 */
public class DatasourceConfigListener implements ConfigurationListener {
	/**
	 * Logger for this class
	 */
	private static final Logger logger = Logger
			.getLogger(DatasourceConfigListener.class);
	
	
	

	public void configurationChanged(ConfigurationEvent event) {
		if (logger.isDebugEnabled()) {
			logger.debug("configurationChanged(ConfigurationEvent=" + event
					+ ") - start");
		}

		if (!event.isBeforeUpdate() ) {
			DataSourceFactory.refresh();
		}

		if (logger.isDebugEnabled()) {
			logger.debug("configurationChanged(ConfigurationEvent=" + event
					+ ") - end");
		}
	}

}
